﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using VK.Comm;

namespace VK.Casemeet.TravelLogs
{
    public static class TravelLogHelper
    {
        #region 日志类型
        public static ListItem[] ObjectTypeData = new ListItem[1]{
            new ListItem("企业日志", "1")
        };

        public static void BindObjectTypeDDL(DropDownList control, OptionType optionType)
        {
            control.Items.Clear();
            control.Items.AddRange(ObjectTypeData);
            switch (optionType)
            {
                case OptionType.Default: break;
                case OptionType.Search: control.Items.Insert(0, new ListItem("全部", "0")); break;
                case OptionType.Select: control.Items.Insert(0, new ListItem("请选择", "0")); break;
            }
            control.SelectedIndex = 0;
        }

        public static string GetObjectTypeLabel(int type)
        {
            string result = string.Empty;
            var items = ObjectTypeData.Where(p => p.Value == type.ToString());
            if (items.Count() > 0)
            {
                result = items.First().Text;
            }
            return result;
        }
        #endregion
    }
}
